#pragma once
#define _USE_MATH_DEFINES
#define OGLFT_NO_QT

#include "BaseWindow.h"
#include "Math/fmtxlib.h"
#include <fcntl.h>
#include <sys/types.h>
#include <string.h>
#include <io.h>
#include <cmath>

//#include <GL/glew.h>
//#include <GL/gl.h>
//#include <GL/glu.h>
#include "OpenGL/OGLFT/OGLFT.h"
#include <GL/glut.h>

#include "colors.h"
#include "textfile.h"

enum SIDES {FRONT, BACK, LEFT, RIGHT, TOP, BOTTOM};

#define SCREEN_DEPTH 16

class MainWindow : public BaseWindow
{
private:
	GLint		viewport[4];
	GLdouble	modelview[16];
	GLdouble	projection[16];
	matrix44	persp;
	matrix44	invView, View, rot, trans;
	bool		timerOn;

	GLuint		base;
    POINT       mousePosR, mousePosL;

    //Zmienne zalezne od programu a nie szkieletu
    matrix44    BMatrix, DBMatrix, DBTMatrix;
    GLdouble    viewZ;
    //zmienne zwiazane z shaderem
    GLuint v,f,p;

	OGLFT::Monochrome* monochrome;	

    //Metody zalezne od programu a nie szkieletu
    void    InitLight();
    void    InitQuadrics();
    void    KillQuadrics();
    void    InitShaders();
protected:

	void	KillFont() { glDeleteLists(base, 96); }
	void	BuildFont2();
	void	reinitWndScreenData();
	void	StartTimer();
	void	StopTimer();

    //Metody zalezne od programu a nie szkieletu
public:
	MainWindow(HINSTANCE hInastance);

	void	InitGL();
	void	Draw();
	void	SizeChanged();
	void	OnInit();
	void	OnCreate();
    void	OnWmCreate();
	void	OnDestroy();
	void	OnMenuChoosed(WPARAM wParam);
	void	OnLButtonDown(WPARAM wParam, LPARAM lParam);
	void	OnRButtonDown(WPARAM wParam, LPARAM lParam);
	void	OnMouseMove(WPARAM wParam, LPARAM lParam);
	void	OnMouseWheel(WPARAM wParam, LPARAM lParam);
	void	OnKeyDown(WPARAM wParam);
	void	OnTimerMethod();
	void	Update();
	void	glPrint(const char* txt, ...);

    //Metody zalezne od programu a nie szkieletu
};